<?php
namespace Admin\Controller;
use Think\Page;

use Think\Controller;

use Common\Controller\AuthController;
class IosPointController extends AuthController {
	public function index(){
		$ios_point = D("IosPoint");
		$count = $ios_point->count();
		$page = new Page($count,7);
		$page->setConfig('prev', '上页');
		$page->setConfig('next', '下页');
		$show = $page->show();
		$list = $ios_point->relation(true)->limit($page->firstRow,$page->listRows)->select();

		$this->assign('list',$list);
		$this->assign('count',$count);
		$this->assign('page',$show);
		$this->display();
	}
	public function add(){
		if(IS_POST){
			$ios_point = D('IosPoint');
			$data = $ios_point->create($_POST);
			$result = $ios_point->add($data);
			if($result){
				$this->success("添加成功","index");
			}else{
				$this->error("添加失败");
			}
		}else{
			$scenic = D("Scenic");
			$list = $scenic->select();
			$this->assign('list',$list);
			$this->display();
		}
	}
	public function delete(){
		$where['id'] = $_GET['id'];
		$ios_point = D('IosPoint');
		$result = $ios_point->where($where)->delete();
		if($result){
			$this->success("删除成功","index");
		}else{
			$this->error("删除失败");
		}
	}
}